******************************
*Table A8: Baseline correlates of child attendance 
************************
clear all
set trace off
set more off
use Jehanabad_analytic_sample_hemoglobin

g el_att= total_attendance_2
replace el_att= total_attendance_2[_n+1] if wave==0


sort child_unique wave
g base_hb=hemoglobin
replace base_hb=hemoglobin[_n-1] if wave==1
g bl_anemic= base_hb < 11.5
g non_anemic =(base_hb >=11.5)

g dfemale=(sex_child==0)
g hindu=(hc_1_household_religon==1)
g f_primary=( years_schooling_father >4)
g m_primary=( years_schooling_mother >4)
g f_sec=( years_schooling_father >9)
g m_sec=( years_schooling_mother >9)
xtile tercile=asset_index, nq(3)
g ln_enrol=ln(total_enrollment)
g ln_class_size=ln(class_size)
g student_ratio=ln(student_teacher_ratio)

label var base_hb "Baseline Hb"
label var bl_anemic "Baseline anemic"
label var mild_an "Mild anemia"
label var mod_sev_an "Moderate/severe anemia"
label var sc_st "Household caste (SC/ST=1)"
label var dfemale "Female"
label var hindu "Religion (Hindu=1)"
label var no_HHmembers "Household size"
label var m_primary "Mother is primary schooled"
label var f_primary "Father is primary schooled"
label var ln_enrol "School enrollment (log)"
label var ln_class_size "Class size (log)"
label var student_ratio "Student-teacher ratio (log)"
label var help_homework "Homework help at home"
label var tercile "Asset index"


areg el_att bl_anemic if wave==0, cluster(school_id) a(block)
outreg2 using tableA8.doc, word replace ctitle(Child attendance) dec(3) keep(bl_anemic) nocons nor2 ///
title(Table A8: Baseline correlates of child attendance at endline) nonotes ///
addnote("Notes: Robust standard errors in parentheses. All models include block fixed effects. SC/ST refers to a scheduled caste and" ///
"scheduled tribe. *** p<0.01, ** p<0.05, * p<0.1") label

areg el_att base_hb if wave==0, cluster(school_id) a(block)
outreg2 using tableA8.doc, word append ctitle(Child attendance) dec(3) keep(base_hb) nocons nor2 label

areg el_att mild_an mod_sev_an if wave==0, cluster(school_id) a(block)
outreg2 using tableA8.doc, word append ctitle(Child attendance) dec(3) keep(mild_an mod_sev_an) nocons nor2 label


areg el_att mild_an mod_sev_an sc_st dfemale hindu no_HHmembers m_primary f_primary ln_enrol ln_class_size student_ratio help_homework i.tercile if wave==0, cluster(school_id) a(block)
outreg2 using tableA8.doc, word append ctitle(Child attendance) dec(3) keep(mild_an mod_sev_an sc_st dfemale hindu no_HHmembers m_primary f_primary ln_enrol ln_class_size student_ratio help_homework i.tercile) nocons nor2 label 

********************************************End of do file *******************


